define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'gou.good_outbound/index',
        add_url: 'gou.good_outbound/add',
        edit_url: 'gou.good_outbound/edit',
        delete_url: 'gou.good_outbound/delete',
        export_url: 'gou.good_outbound/export',
        modify_url: 'gou.good_outbound/modify',
        edit_remark: 'gou.good_outbound/edit_remark',
        goodw_detail: 'gou.good_outbound/goodw_detail',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh',
                    [{
                        text: '新建出库单',
                        url: init.add_url,
                        method: 'open',
                        auth: 'add',
                        class: 'layui-btn layui-btn-normal layui-btn-sm',
                        icon: 'fa fa-plus ',
                        extend: 'data-full="true"',
                    }]
                ],
                cols: [[
                    {field: 'id', minWidth: 80, title: 'ID',search: false},
                    {field: 'outbound_no', minWidth: 80, title: '出库单号'},
                    {field: 'outbound_name', minWidth: 80, title: '出库单名称',search: false},
                    {field: 'outbound_type', title: '出库类型', selectList: {1: '销售出库',2: '作废入库'}},
                    {field: 'remarks', minWidth: 80, title: '备注',search: false},
                    {field: 'good_outbound_time', title: '出库时间',search: false},
                    {title: '操作', templet: ea.table.tool,operat:[
                        [
                            {
                                text: '编辑',
                                url: init.edit_url,
                                method: 'open',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-success',
                                extend: 'data-full="true"',
                            }
                       ],
                       [
                           {
                               text: '详情',
                               url: init.goodw_detail,
                               method: 'open',
                               auth: 'edit',
                               class: 'layui-btn layui-btn-xs layui-btn-success',
                               extend: 'data-full="true"',
                           }
                      ],
                      [
                        {
                           text: '备注',
                           url: init.edit_remark,
                           method: 'open',
                           auth: 'edit',
                           class: 'layui-btn layui-btn-xs layui-btn-danger'
                       }
                      ]
                    ]},
                ]],
            });
            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        edit_remark: function () {
            ea.listen();
        },
    };
    return Controller;
});